package platform.user.auth.token;

import org.springframework.stereotype.Component;

/**
 * 令牌生成器
 *
 * @author roamer
 * @version V1.0
 * @date 2019-03-10 13:33
 */
@Component
public class TokenGenerator {

    /** 有效时长 */
    private long sessionLength = 0;

    public TokenGenerator() {

    }

    public TokenGenerator(long defaultSessionLength) {
        this.sessionLength = defaultSessionLength;
    }

    public SessionToken createToken(String username) {
        return new SessionToken(username, sessionLength);
    }
}
